package com.wc.AlgoOJ_homework.ALOJ模块测试Ⅲ.H_作物杂交;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/5/20 17:39
 * @description http://43.138.190.70:8888/p/LQ1104?tid=66444686c0c2f98e569f403b
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 2010, M = 200010, INF = 0x3f3f3f3f, idx = 1;
    static int[] h = new int[N], ne = new int[M], e = new int[M], w = new int[N], target = new int[M];
    static int[] dist = new int[N];
    static boolean[] st = new boolean[N];
    static Queue<Integer> q = new LinkedList<>();
    static int n, m, k, T;

    public static void main(String[] args) {
        n = sc.nextInt();
        m = sc.nextInt();
        k = sc.nextInt();
        T = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            w[i] = sc.nextInt();
        }
        Arrays.fill(dist, 1, n + 1, INF);
        while (m-- > 0) {
            int x = sc.nextInt();
            dist[x] = 0;
            q.add(x);
            st[x] = true;
        }
        while (k-- > 0) {
            int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();
            // a + b -> c
            add(a, b, c);
            add(b, a, c);
        }
        spfa();
        out.println(dist[T]);
        out.flush();
    }

    static void add(int a, int b, int c) {
        e[idx] = b;
        target[idx] = c;
        ne[idx] = h[a];
        h[a] = idx++;
    }

    static void spfa() {
        while (!q.isEmpty()) {
            int x = q.poll();
            st[x] = false;
            for (int i = h[x]; i > 0; i = ne[i]) {
                int y = e[i], z = target[i];
                if (dist[z] > Math.max(dist[x], dist[y]) + Math.max(w[x], w[y])) {
                    dist[z] = Math.max(dist[x], dist[y]) + Math.max(w[x], w[y]);
                    if (!st[z]) {
                        q.add(z);
                        st[z] = true;
                    }
                }
            }
        }
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
